<?php

namespace addons\kzvote;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Kzvote extends Addons
{

    protected $menu = [
        [
            "name"=> "kzvote",
            "title"=> "多功能投票",
            "icon"=> "fa fa fa-columns",
            "sublist"=> [
                [
                    "name"=> "kzvote/temp",
                    "title"=> "投票模板",
                    "icon"=> "fa fa-camera-retro",
                    "weigh"=> 99,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/temp/temp",
                            "title"=> "默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、des",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/temp/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/temp/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/temp/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/temp/del",
                            "title"=> "Del",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/temp/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/vote",
                    "title"=> "投票活动",
                    "icon"=> "fa fa-bomb",
                    "weigh"=> 98,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/vote/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/vote/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/vote/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/vote/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/vote/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/vote/copy",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/person",
                    "title"=> "投票作品",
                    "icon"=> "fa fa-user-plus",
                    "weigh"=> 97,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/person/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/person/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/person/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/person/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/person/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/person/export",
                            "title"=> "作品导出",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/gift",
                    "title"=> "投票礼物",
                    "icon"=> "fa fa-archive",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/gift/gift",
                            "title"=> "礼物管理",
                            "icon"=> "fa fa-bandcamp",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/gift/gift/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/gift/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/gift/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/gift/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/gift/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/gift/order",
                            "title"=> "礼物订单",
                            "icon"=> "fa fa-align-justify",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/gift/order/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/delunpay",
                                    "title"=> "删除未付款的订单",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/gift/order/give",
                                    "title"=> "送礼",
                                    "weigh"=> 0
                                ]
                            ]
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/log",
                    "title"=> "投票记录",
                    "icon"=> "fa fa-list-ol",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/log/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/log/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/log/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/log/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/log/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/log/export",
                            "title"=> "导出投票记录",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/group",
                    "title"=> "作品分组",
                    "icon"=> "fa fa-circle-o",
                    "weigh"=> 0,
                    "ismenu"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/group/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/group/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/group/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/group/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/group/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/review",
                    "title"=> "作品弹幕",
                    "icon"=> "fa fa-arrows",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/review/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/review/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/review/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/review/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/review/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/music",
                    "title"=> "背景音乐",
                    "icon"=> "fa fa-music",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/music/cate",
                            "title"=> "音乐分类",
                            "icon"=> "fa fa-certificate",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/music/cate/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/cate/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/cate/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/cate/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/cate/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/music/music",
                            "title"=> "背景音乐",
                            "icon"=> "fa fa-music",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/music/music/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/music/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/music/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/music/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/music/music/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/complaint",
                    "title"=> "投诉管理",
                    "icon"=> "fa fa-bookmark",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/complaint/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/complaint/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/complaint/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/complaint/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/complaint/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/option",
                    "title"=> "报名选项",
                    "icon"=> "fa fa-black-tie",
                    "weigh"=> 0,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/option/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/option/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/option/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/option/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/option/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/faq",
                    "title"=> "常见问题",
                    "icon"=> "fa fa-file-word-o",
                    "weigh"=> 0,
                    "ismenu"=> 1,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/faq/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/faq/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/faq/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/faq/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/faq/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/vote/case",
                    "title"=> "经典案例",
                    "icon"=> "fa fa-product-hunt",
                    "weigh"=> 0,
                    "ismenu"=> 1,
                    "sublist"=> []
                ],
                [
                    "name"=> "kzvote/notice",
                    "title"=> "系统公告",
                    "icon"=> "fa fa-yelp",
                    "weigh"=> 0,
                    "ismenu"=> 1,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/notice/index",
                            "title"=> "查看",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/notice/add",
                            "title"=> "添加",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/notice/edit",
                            "title"=> "编辑",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/notice/del",
                            "title"=> "删除",
                            "weigh"=> 0
                        ],
                        [
                            "name"=> "kzvote/notice/multi",
                            "title"=> "批量更新",
                            "weigh"=> 0
                        ]
                    ]
                ],
                [
                    "name"=> "kzvote/configs",
                    "title"=> "系统设置",
                    "icon"=> "fa fa-cog",
                    "weigh"=> -1,
                    "sublist"=> [
                        [
                            "name"=> "kzvote/banner",
                            "title"=> "幻灯片",
                            "icon"=> "fa fa-image",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/banner/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/banner/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/banner/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/banner/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/banner/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/nav",
                            "title"=> "导航矩阵",
                            "icon"=> "fa fa-navicon",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/nav/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/nav/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/nav/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/nav/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/nav/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/tabbar",
                            "title"=> "底部导航",
                            "icon"=> "fa fa-list-ul",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/tabbar/index",
                                    "title"=> "查看",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/tabbar/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/tabbar/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/tabbar/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/tabbar/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/config",
                            "title"=> "系统配置",
                            "icon"=> "fa fa-gears",
                            "weigh"=> 0,
                            "sublist"=> [
                                [
                                    "name"=> "kzvote/config/index",
                                    "title"=> "默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、des",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/config/add",
                                    "title"=> "添加",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/config/edit",
                                    "title"=> "编辑",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/config/del",
                                    "title"=> "删除",
                                    "weigh"=> 0
                                ],
                                [
                                    "name"=> "kzvote/config/multi",
                                    "title"=> "批量更新",
                                    "weigh"=> 0
                                ]
                            ]
                        ],
                        [
                            "name"=> "kzvote/config?type=wxapp",
                            "title"=> "小程序设置",
                            "icon"=> "fa fa-rocket",
                            "weigh"=> 0,
                            "ismenu"=> 1,
                            "sublist"=> []
                        ],
                        [
                            "name"=> "kzvote/config?type=wechat",
                            "title"=> "公众号配置",
                            "icon"=> "fa fa-gear",
                            "weigh"=> 0,
                            "ismenu"=> 1,
                            "sublist"=> []
                        ]
                    ]
                ]
            ]
        ]
    ];


    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        Menu::create($this->menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('kzvote');
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable('kzvote');
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable('kzvote');
        return true;
    }

    /**
     * 插件升级方法
     * @return bool
     */
    public function upgrade()
    {
        // 如果菜单有变更则升级菜单
        Menu::upgrade('kzvote', $this->menu);
        return true;
    }

}
